@extends(config('admin.systems.layout_blade'))

@section('content')
    <div class="row">
        <div class="col-md-12">
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">友情链接管理</h3>

                </div>

                <!-- /.box-header -->
                <div class="box-body">
                    <div class="mailbox-controls">
                        <!-- Check all button -->

                        <div class="btn-group">
                            @permission('admin-basic-link-delete')
                            <button type="button" class="btn btn-danger btn-sm ajax-post confirm" data-url="{{ get_admin_url('basic/link/delete') }}" data-target-form="ids" data-prompt-information="确定要删除选中的数据吗？"><i class="fa fa-trash-o"></i></button>
                            @endpermission
                            <button type="button" class="btn btn-default btn-sm" title="上一步" onclick="window.history.go(-1);"><i class="fa fa-reply"></i></button>
                            <button type="button" class="btn btn-default btn-sm" title="下一步" onclick="window.history.forward()"><i class="fa fa-share"></i></button>
                        </div>

                        @permission('admin-basic-link-edit')
                        <a href="{{ get_admin_url('basic/link/edit', ['id'=>0]) }}" class="btn btn-success btn-sm checkbox-toggle"><i class="fa fa-plus"></i></a>
                    @endpermission

                    <!-- /.btn-group -->
                        <button type="button" class="btn btn-primary btn-sm" onclick="window.location.reload();"><i class="fa fa-refresh"></i></button>
                        <div class="pull-right">
                            {{ $data->currentPage() }}-{{ $data->lastPage() }}/{{ $data->total() }}
                            <div class="btn-group">
                                <a href="{{ $data->previousPageUrl()  ? : 'javascript:void(0)' }}" type="button" class="btn btn-default btn-sm" {{ $data->previousPageUrl() ? '' : 'disabled' }}><i class="fa fa-chevron-left"></i></a>
                                <a href="{{ $data->nextPageUrl() ? : 'javascript:void(0)' }}" type="button" class="btn btn-default btn-sm" {{ $data->nextPageUrl() ? '' : 'disabled' }}><i class="fa fa-chevron-right"></i></a>
                            </div>
                            <!-- /.btn-group -->
                        </div>
                        <!-- /.pull-right -->
                    </div>

                    <table class="table table-bordered">
                        <tr>
                            <th style="width: 10px"><input type="checkbox" name="ids" value="0" class="check-all"></th>
                            <th>编号</th>
                            <th>图标</th>
                            <th>友情链接名称</th>
                            <th>描述</th>
                            <th>创建时间</th>
                            <th style="width: 160px;">操作</th>
                        </tr>
                        @foreach ($data as $key=>$value)
                            <tr>
                                <td>
                                    <input type="checkbox" name="ids[]" class="ids" value="{{ $value->id }}">
                                </td>
                                <td>{{ $value->id }}</td>
                                <td><img src="{{ get_upload_url($value->cover) }}" class="img-responsive" width="120" alt=""></td>
                                <td><a href="#" onclick="openLayerIFrame('{{ $value->links }}', '{{ $value->title }}')">{{ $value->title }}</a></td>
                                <td>{{ $value->description }}</td>
                                <td>{{ $value->created_at }}</td>
                                <td>
                                    @permission('admin-basic-link-edit')
                                    <a href="{{ get_admin_url('basic/link/edit', ['id'=>$value->id]) }}" class="btn btn-success btn-sm"><i class="fa fa-edit"></i></a>
                                    @endpermission
                                    @permission('admin-basic-link-delete')
                                    <a href="{{ get_admin_url('basic/link/delete', ['ids'=>$value->id]) }}" class="btn btn-danger btn-sm ajax-get confirm" data-prompt-information="确定要删除（{{ $value->name }}）该友情链接吗？"><i class="fa fa-trash-o"></i></a>
                                    @endpermission
                                </td>
                            </tr>
                        @endforeach
                    </table>
                </div>

                <!-- /.box-body -->
                <div class="box-footer clearfix">
                    {{ $data->links() }}
                </div>
            </div>
            <!-- /.box -->
        </div>
    </div>
@endsection